<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%
Object obj=request.getSession().getAttribute("role_resource");
if(null==obj){
	response.setStatus(1000);
	return;
}
%> 
    
	<script type="text/javascript">
	
		//交易代码列表数据源
		var code_store = new Ext.data.JsonStore({
    		root: "data",
    		totalProperty: "total",
    		fields: ["trancode","tranname","trantype","typename"],
    		url: "systemTranCode!selectSystemTranCode.action"
    	});
    	
    	//表单卡类型下拉列表列表数据源
		var type_store = new Ext.data.JsonStore({
    		root: "data",
    		totalProperty: "total",
    		fields : [ "id", "text"],
			url : "product!ProdType.action"
    	});
    	
    	//卡类型下拉列表列表数据源
		var type_store1 = new Ext.data.JsonStore({
    		root: "data",
    		totalProperty: "total",
    		fields : [ "id", "text"],
			url : "product!ProdType.action",
			listeners : {
				"load": function() {
					var RecordName = Ext.data.Record.create([
						{name: "id"},
						{name: "text"}
					]);
					var newRecord = new RecordName({
						id:"",
						text: "全部"
					});
					this.insert(0,newRecord);
				}
			}
    	});
    	
    	var sel = function(){
			code_store.baseParams = code_store.baseParams || {};

			code_store.baseParams["systemTranCode.trancode"] = Ext.getCmp("a").getValue();
			code_store.baseParams["systemTranCode.tranname"] = Ext.getCmp("b").getValue();
			code_store.baseParams["systemTranCode.trantype"] = Ext.getCmp("c").getValue();
						
			code_store.load({params:{start:0,limit:limit}});
		};

		//定义数据显示面板
		var p1 = {
			id: "p1",
			xtype: "grid",
			stripeRows:true,
			loadMask : true,//在加载数据时遮罩住元素,替换元素Updater的加载提示器，并且在初始化加载之后销毁
			autoExpandColumn: "tranname",
			autoExpandMin : 100,//自动填充最小宽度
			store: code_store,
			headersDisabled: true,
			columns:[
	        	new Ext.grid.RowNumberer({header: "序号", width: 35}),
    					{header: "代码",		dataIndex: "trancode",	menuDisabled: true},
    					{header: "名称",		dataIndex: "tranname",	id: "tranname",	menuDisabled: true},
    					{header: "类型",		dataIndex: "typename",	menuDisabled: true}
			],
			bbar: new Ext.ux.PagingToolbar({
            	pageSize: limit,
            	store: code_store
        	}),
    	   	tbar:["&nbsp&nbsp类型:",{
				id: "c",
				xtype: "billCombox",
				store: type_store1,
				width: 120,
				value:"",
				listeners: {
					"select": sel
				}
			},"&nbsp&nbsp代码:",
    	   	{
				id: "a",
				xtype: "textfield",
				maxLength: 10,
				enableKeyEvents: true,
				listeners: {
					keypress:function(t,e){
						 if(13==e.getKey()){
							 sel();
						 }
					}
				}
			},"&nbsp&nbsp名称:",
			{
				id: "b",
				xtype: "textfield",
				enableKeyEvents: true,
				listeners: {
					keypress:function(t,e){
						 if(13==e.getKey()){
							 sel();
						 }
					}
				}
			}]
		};
		code_store.load({params:{start:0,limit:limit}});
		type_store.load();
		type_store1.load();
	
	
		var CenterPanel=Ext.getCmp("CenterPanel");
		CenterPanel.removeAll();
		CenterPanel.add(p1);
		CenterPanel.doLayout();
	</script>
